/**
 * Created by Administrator on 2017/7/7 0007.
 */
define(["jquery","bbcare","scprit/department/vm/queueManagement/createQueue-data.js"],function($,$bb,$tpl) {
    var URL = $bb.baseUrl("department") + "followup/service";
    var toAjax={};
    //方案初始化：
    toAjax.followup=function(params,fn){
        $bb.ajax({
            url: URL + "/scheme/followSchemeListQuery",
            data: JSON.stringify({
                data: params
            }),
            success: function (data) {
                if(data.success){
                    fn(data);
                }
            }
        });
    };

    //管理列表初始化：
    toAjax.managementList=function(fn){
        $bb.ajax({
            url: URL + "/queue/authority/rolelist",
            success: function (data) {
                if(data.success){
                    fn(data);
                }
            }
        });
    };
   toAjax.doctorRole=function(fn){
       $bb.ajax({
           url: URL + "/queue/authority/doctors",
           success: function (data) {
               if(data.success){
                   fn(data)
               }
           }
       });
   };
    //上传：
    toAjax.upload=function(obj,file,fn) {
        var fd = new FormData();
        fd.append("file", file);//上传的文件： 键名，键值
        $bb.ajax({
            url: URL+"/queue/uploadQueueLogo",
            processData: false,  // 告诉jQuery不要去处理发送的数据
            contentType: false,   // 告诉jQuery不要去设置Content-Type请求头
            data: fd,
            success: function(data){
                if(data.success){
                    fn(data)
                }else{
                    $bb.toastShow(data.msg ? data.msg :"上传图片失败！");
                }
            }
        });
    };
    //提交：
   toAjax.toSubmit=function(params,fn){
       $bb.ajax({
           url: URL + "/queue/modify",
           data: JSON.stringify({
               data:params
           }),
           success: function (data) {
               console.log(data);
               if(data.success){
                   fn(data);
               }
           }
       });
   };
   //获取队列信息：
    toAjax.getQueueDetails=function(params,fn){
        $bb.ajax({
            url: URL + "/queue/detail",
            data: JSON.stringify({
                data:params
            }),
            success: function (data) {
                if(data.success){
                    fn(data);
                }
            }
        });
    }
    //获取队列医生权限：
    toAjax.getQueueDoctors=function(params,fn){
        $bb.ajax({
            url: URL + "/queue/authority/teams",
            data: JSON.stringify({
                data:params
            }),
            success: function (data) {
                if(data.success){
                    fn(data);
                }
            }
        });
    }
    return toAjax
});